In Dart, there are no keywords like public
, protected
, and private
. To distinguish between public and
private there’s a convention, if an identifier starts with an underscore (_), it’s private to its library. In the context of library prefixes there’s
no notion of private, so starting it with underscore will only be source of confusion for the developers. That’s why it’s recommended to not start the
library prefix with an underscore _
.
Code examples
Noncompliant code example
import 'dart:io' as _io;
import 'dart:math' as _math;
import 'dart:js' as _js;
Compliant solution
import 'dart:io' as io;
import 'dart:math' as math;
import 'dart:js' as js;